var firstNode;

function sendCreatures() 
{
    this._temp.zoom();

}

function testingLocalization()
{
	var myString = TCUtil.getRelativeString(Core.Localization.getString("MM_ALERT_SELL_HABITAT"), [10 , "coin(s)"]);
	var temp = Core.Localization.getString('communicationError');
	
}

function sortNumberDesc(a, b)
{
	return b - a;
}

function sortNumberAsc(a, b)
{
	return a - b;
}

var LifecycleListener = Core.MessageListener.subclass( {
		initialize : function() {
			//NgLogE("LifeCycleListener initialize");
			Device.LifecycleEmitter.addListener(this, this.onLifecycleUpdate);
		},
	
		destroy : function() {
			//NgLogE("LifeCycleListener destroy");
			Device.LifecycleEmitter.removeListener(this);
		},
	
	
		onLifecycleUpdate : function(event) {
													//  return;
			//console.log('LifeCycle Update: ' + event);
			if (event == Device.LifecycleEmitter.Event.Suspend){	
				//AnalyticsHandler.logAnalyticsEvent("Suspend");							  
				//UIFactory.showBlockView();
				//UIFactory.showProgressHUD(Core.Localization.getString("resumeGame"));									  
//				if(MMGameLayer.getMyUserLayer()){									  
//					MMGameLayer.getMyUserLayer().clearTimeouts();
//					GameCentralHandler.getGameLoader().areTimesSynchronized = false;
//				}
			}
			else if (event == Device.LifecycleEmitter.Event.Resume){
				//AnalyticsHandler.logAnalyticsEvent("Resume");
				//NgLogE("LifeCycleListener Resume");
				//UIFactory.hideBlockView();								  
//				if(GameCentralHandler.getGameLoader().getIsSyncSuccess()){
//					GameCentralHandler.getGameLoader().synchronizeServerTime(true);
//				}
			}
		}
});

function main()
{
	Device.OrientationEmitter.setInterfaceOrientation(Device.OrientationEmitter.Orientation.Portrait, false);
	NgApplication.getInstance().setOrientation(NgApplicationOrientation.Portrait);
	var orientationInterfaceListener = new InterfaceListener();
	//Device.OrientationEmitter.Orientation.LandscapeLeft
    var glView = new UI.GLView();
	glView.onload = function()
	{
      	GameCentralHandler.instantiate();
		GameCentralHandler.setOrientationInterfaceListener(orientationInterfaceListener);
      	GameCentralHandler.loadSplashScreen();
	  	var lifecycleListener = new LifecycleListener();
	};
	
	glView.setAttribute('frame', [0, 0, NGWindow.outerWidth, NGWindow.outerHeight]);
	glView.setAttribute('active', true);
	   
}
